package com.nnnu.wsnackshop.pojo.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author zk
 * @since 2025-05-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("orders")
public class Orders implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 订单ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 订单编号（前端展示用）
     */
    private String orderNo;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 门店ID
     */
    private Integer storeId;

    /**
     * 地址ID
     */
    private Integer addressId;

    /**
     * 优惠券ID
     */
    private Integer couponId;

    /**
     * 商品总金额（不含运费、优惠）
     */
    private BigDecimal goodsAmount;

    /**
     * 运费
     */
    private BigDecimal deliveryFee;

    /**
     * 优惠金额
     */
    private BigDecimal discountAmount;

    /**
     * 总金额（最终支付金额）
     */
    private BigDecimal totalAmount;

    /**
     * 支付方式：wechat=微信, alipay=支付宝, balance=余额
     */
    private String paymentMethod;

    /**
     * 配送方式：local=同城配送, self=自提
     */
    private String deliveryType;

    // /**
    // * 状态：pending=待付款, paid=已支付, shipping=配送中, completed=已完成, cancelled=已取消
    // */
    // private String status;

    /**
     * 支付状态：0=pending,1=paid,2=refunded
     */
    @TableField("pay_status")
    private Integer payStatus;

    /**
     * 订单状态：0=new,1=accepted,2=packing,3=delivering,4=completed,5=cancelled,6=delivered7=pickup
     */
    @TableField("order_status")
    private Integer orderStatus;

    /**
     * 订单备注
     */
    private String remark;

    /**
     * 配送备注
     */
    private String deliveryNotes;

    /**
     * 支付时间
     */
    private LocalDateTime paymentTime;

    /**
     * 发货时间
     */
    private LocalDateTime deliveryTime;

    /**
     * 完成时间
     */
    private LocalDateTime completedTime;

    /**
     * 取消时间
     */
    private LocalDateTime cancelledTime;

    /**
     * 取消原因
     */
    private String cancelReason;

    /**
     * 是否删除 0-未删除 1-已删除
     */
    private Integer deleted;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;
}
